#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 255;

int n, m;
int a[N], b[N];
ll dp[2][1005];
bool check(int x) {
  rep(i, 0, m) dp[0][i] = -1e9;
  dp[0][0] = 0;
  int pre = 0, now = 1;
  rep(i, 1, n) {
    now = i & 1, pre = now ^ 1;
    ll w = 1000ll * b[i] - 1ll * x * a[i];
    rep(j, 0, m) dp[now][j] = dp[pre][j];
    rep(j, 0, m) {
      int k = min(m, j + a[i]);
      dp[now][k] = max(dp[now][k], dp[pre][j] + w);
    }
  }
  return dp[n & 1][m] >= 0;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i] >> b[i];
  int l = 1, h = 1e6;
  while (l <= h) {
    int mid = (l + h) >> 1;
    if (check(mid))
      l = mid + 1;
    else
      h = mid - 1;
  }
  cout << h;
  return 0;
}